<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>props的基本使用方法</title>
</head>
<body>
  <!-- 准备一个容器 -->
  <div id="test"></div>
  <div id="test1"></div>
  <div id="test2"></div>

  <!-- 导入react包 -->
  <script type="text/javascript" src="../js/react.development.js"></script>
  <script type="text/javascript" src="../js/react-dom.development.js"></script>
  <script type="text/javascript" src="../js/babel.min.js"></script>

  <script type="text/babel">
  // 创建组件
  class Person extends React.Component{
    render(){
      const { name, age, sex } = this.props
      return (
        <div>
          <ul>
            <li>姓名: { name }</li>
            <li>性别: { sex }</li>
            <li>年龄: { age }</li>
          </ul>
        </div>
      )
    }
  } 

  // 渲染组件到页面
  ReactDOM.render(<Person name="tom" age={18} sex="女"/>, document.getElementById('test'))
  ReactDOM.render(<Person name="jerry" age={20} sex="男"/>, document.getElementById('test1'))
  ReactDOM.render(<Person name="jack" age="29" sex="男"/>, document.getElementById('test2'))
  </script>

</body>

</html>